<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>工勿忧</title>
<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
<link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
<link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>

<body>
<style>
.list {
	border: solid #ddd 1px;border-radius: 5px;width: 97%;margin-left: 3%;margin-top: 15px;background-color: aliceblue;box-shadow: 3px 3px 3px #ccc;
}
.list2 {
	border: solid rgb(248, 101, 101) 1px;border-radius: 5px;width: 97%;margin-left:3%;margin-top: 15px;background-color:rgb(253,161,161);box-shadow: 3px 3px 3px rgb(253,161,161);
}
table {}
table tr td { padding: 5px; }
.list2 table tr td { color:#ff0; }
</style>

<div class="hui-wrap" id="record_2">
	<div class="hui-list" style="background:#FFFFFF;margin-top:3px;padding-right:10px;">
		<ul id="list">

		</ul>
	</div>
</div>


<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-tab.js" type="text/javascript"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
	apiready = function () {
		v = api.pageParam.v;
		i = api.pageParam.i;
		list(v,i)
	}


	function list(v, i) {

		api.ajax({
			url: $api.getStorage('geturl') + '&c=ajaxmember&a=updatalist',
			method: 'post',
			data: {
				values: { 
					userid: $api.getStorage('userid'),
					v: v,
				}
			}
		},function(res, err){

			if (res) {			
				if (res.status==1) {
					//console.log(JSON.stringify(res))
					//数据上报
					var updata = ''					
					for (i = 0; i < res.data.length; i++) {
						
						//血压,血脂,血糖,慢性肺阻						
						if (v == '血压') {
							
							var style = 'list';
							if (res.data[i].status1 == 1) {
								style = "list2"
							}							
							updata += '<div class="'+style+'"><table>'
							updata += '<tr><td>测 量 值：' + res.data[i].bloodmin + ' - ' + res.data[i].bloodmax + ' mmHg</td></tr><tr><td>标 准 值：' + res.bzz.bloodmin + '~~' + res.bzz.bloodmax + '</td></tr><tr><td>测量时间：' + jsDateDiff(res.data[i].cltime,1) + '</td></tr><tr><td>上报时间：' + jsDateDiff(res.data[i].addtime,1) + '</td></tr>'
							updata += '</table></div>'							
							
						} else if (v == '血脂') {
							
							var style = 'list';
							if (res.data[i].status3 == 1) {
								style = "list2"
							}
							updata += '<div class="'+style+'"><table>'
							updata += '<tr><td>测 量 值：' + res.data[i].bloodlipid + ' mmol/L</td></tr><tr><td>标 准 值：' + res.bzz.bloodlipidmin + '~~' + res.bzz.bloodlipidmax + '</td></tr><tr><td>测量时间：' + jsDateDiff(res.data[i].cltime,1) + '</td></tr><tr><td>上报时间：' + jsDateDiff(res.data[i].addtime,1) + '</td></tr>'
							updata += '</table></div>'

						} else if (v == '血糖') {

							var style = 'list';
							if (res.data[i].status2 == 1) {
								style = "list2"
							}
							updata += '<div class="'+style+'"><table>'							
							updata += '<tr><td>测 量 值：' + res.data[i].bloodsugar + 'mmol/L</td></tr><tr><td>标 准 值：' + res.bzz.bloodsugarmin + '~~' + res.bzz.bloodsugarmax + '</td></tr><tr><td>测量时间：' + jsDateDiff(res.data[i].cltime,1) + '</td></tr><tr><td>上报时间：' + jsDateDiff(res.data[i].addtime,1) + '</td></tr>'
							updata += '</table></div>'
						}
						
					}

					hui("#list").html(updata)
					
				}else{
					api.toast({ msg:res.tip,location:'top' })
				}
			} else {
				alert( JSON.stringify( err ) );
			}
		}); 


	}


	hui('#hui-header-menu').click(function () {
		hui.actionSheet(menus, cancel, function (e) {
			console.log(e.index);
			hui.toast(e.innerHTML);
		});
	});


	function tip() {
		hui.prompt('您确认要这处理吗？', ['取消', '确定'], function (name) {
			hui.toast('您输入了 :' + name);
		},
			'例如 : 张三',
			'已联系本人处理',
			function () {
				hui.toast('您点击了取消')
			});
	}

	/*function tab(i) {
		if (i == 1) {
			hui("#record_1").show();
			hui("#record_2").hide();
			var UILineChart = api.require('UILineChart');
			UILineChart.open();
		} else {
			var UILineChart = api.require('UILineChart');
			UILineChart.close();
			hui("#record_1").hide();
			hui("#record_2").show();
		}
	}*/

</script>

</body>

</html>